package com.cy.module.controller;

import com.cy.module.pojo.RequestParameter;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController//返回值时json格式字符串只有数据没有页面
public class ParamObjectController {
    @GetMapping("/doParam01")//@GetMapping任意请求类型
    public String doMethondParam(String name){
        return "request params "+name;//直接量
    }
    @GetMapping("/doParam02")
    public String doMethodParam(RequestParameter param){
        //pojo对象接收请求参数,pojo对象中需提供与参数名相匹配的set方法
        return "request params "+param.toString();
    }
    @GetMapping("/doParam03")
    public String doMethodParam(@RequestParam Map<String,Object> param){
        return "request params "+param.toString();
    }
}
